package com.kang.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kang.commons.Result;
import com.kang.bean.Box;
import com.kang.mapper.BoxMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: blog-service
 * @description: 推箱子
 * @author: K.faWu
 * @create: 2021-12-24 14:49
 **/
@RestController
@RequestMapping("box")
public class BoxController {
    @Autowired
    private BoxMapper boxMapper;

    @PostMapping
    public Result<?> addBox(@RequestBody Box box){
        boxMapper.inset(box);
        return Result.success();
    }

    @GetMapping
    public Result<?> getList(){
        List<Box> list = boxMapper.selectList(new QueryWrapper<>());
        return Result.success(list);
    }
}
